#pragma once

#include"RBTree.h"


namespace bit
{
	template<class k>
	class set
	{
		struct KeyofT
		{
			k& operator()( k& key)
			{
				return key;
			}
		};
	public:
		typedef typename RBTree<k, k, KeyofT>::iterator iterator;
		set() = default;

		set(const set<k>& key)
			:_root(key._root)
		{ }

		bool insert(k& key)
		{
			return _root.Insert(key);
		}

		iterator begin()
		{
			return _root.begin();
		}

		iterator end()
		{
			return _root.end();
		}

		size_t erase(k& key)
		{
			if (_root.Erase(key))
				return 1;
			else
				return 0;
		}


		iterator find(k& key)
		{
			return _root.Find(key);
		}

		bool empty()
		{
			return begin() == end();
		}

	private:

		RBTree<k, k, KeyofT> _root;
	};
}